<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>会员注册_中国根雕行业网</title>
    <link href="../css/regist.css" type="text/css" rel="stylesheet">
    <link href="../css/style.css" type="text/css" rel="stylesheet">
</head>
<body>

<!--头部-->
<div class="top">
    <div class="top_box">
        <div class="top_box_left">
            <div class="black fw_b fs_12">欢迎光临中国根雕行业网</div>
        </div>
    </div>
</div>

<div class="content">
    <div class="content_top">
        <div class="logo" align="center">
            <img src="../img/logo.png" alt="中国根雕行业网">
        </div>

        <div class="tittle">
            会员注册
        </div>
    </div>
</div>

<div class="line">
</div>


<div class="information bor">
    <img src="../regist/re1.jpg" alt="完善信息资料">

    <div class="info_box">
        <h3>信息资料</h3>
        <div class="info">
            <div class="info_left">
                <span class="info_tit">公司名称</span>
            </div>
            <div class="info_right">
                <input type="text" class="info_in" id="comName" onblur="checkName()">
            </div>
        </div>
        <div class="info">
            <div class="info_left">
                <span class="info_tit">公司电话</span>
            </div>
            <div class="info_right">
                <input type="text" class="info_in" id="comCall" onblur="checkCall()">
            </div>
        </div>
        <div class="info">
            <div class="info_left">
                <span class="info_tit">负责人手机号码</span>
            </div>
            <div class="info_right">
                <input type="password" class="info_in" id="comTel" onblur="checkTel()">
            </div>
        </div>
        <div class="info">
            <div class="info_left">
                <span class="info_tit">公司地址</span>
            </div>
            <div class="info_right">
                <input type="password" class="info_in" id="comAddress" onblur="checkAddress()">
            </div>
        </div>
        <div class="info">
            <div class="info_left">
                <span class="info_tit">预留问题</span>
            </div>
            <div class="info_right">
                <select id="question">
                    <option>您的出生地？</option>
                    <option>您最喜欢的作品？</option>
                    <option>您父亲的姓名？</option>
                    <option>您母亲的姓名？</option>
                    <option>您配偶的姓名？</option>
                </select>
            </div>
        </div>
        <div class="info">
            <div class="info_left">
                <span class="info_tit">预留问题答案</span>
            </div>
            <div class="info_right">
                <input type="password" class="info_in" id="answer" onblur="checkAnswer()">
            </div>
        </div>
        <div class="bu white" onclick="submit()">确认提交</div>
    </div>
</div>


<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript">
    var comCall;
    var comName;
    var comTel;
    var comAddress;
    var question;
    var answer;
    //用户姓名正则
    var de_name = /^[\u4e00-\u9fa5]{0,}$/;
//    座机正则
    var de_call = /\d{3}-\d{8}|\d{4}-\d{7}/;
    //    手机正则
    var de_tel= /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
    //    检验用户名
    function checkName() {
        comName = $.trim($("#comName").val());
        if (comName == "" || de_name.test(comName) == false || comName.length < 2) {
            alert("请填写真实的公司名");
            return 2;
        } else {
            return 1;
        }
    }
    //   检验座机
    function checkCall() {
        comCall = $.trim($("#comCall").val());
        if (comCall == "") {
            alert("请填写电话号码");
            return 2;
        } else if (de_call.test(comCall) == false) {
            alert("请填写正确的座机号码");
            return 2;
        }else{
            return 1;
        }
    }
    //   检验电话
    function checkTel() {
        comTel = $.trim($("#comTel").val());
        if (comTel == "") {
            alert("请填写电话号码");
            return 2;
        } else if (de_tel.test(comTel) == false) {
            alert("请填写正确的手机号码");
            return 2;
        }else{
            return 1;
        }
    }
    //    检验地址
    function checkAddress(){
        comAddress = $.trim($("#comAddress").val());
        if (comAddress == "") {
            alert("请填写地址");
            return 2;
        }else{
            return 1;
        }
    }
    //    检验答案
    function checkAnswer(){
        answer = $.trim($("#answer").val());
        if (answer == "") {
            alert("请输入预留问题答案");
            return 2;
        }else{
            return 1;
        }
    }


    function submit() {
        comName = $.trim($("#comName").val());
        comCall = $.trim($("#comCall").val());
        comTel = $.trim($("#comTel").val());
        comAddress = $.trim($("#comAddress").val());
        question = $.trim($("#question").val());
        answer = $.trim($("#answer").val());
        if (comName == "" || comCall == "" || comTel == "" || comAddress == ""||answer=="") {
            alert("请完善所有信息")
        }else if(checkTel()+checkName()+checkAddress()+checkAnswer()+checkCall()!=5){
            alert("信息有误，请核对确认")
        }else{
            alert("注册成功")
        }
    }
</script>


</body>
</html>